﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace Cxuu.Web.Api
{
    //[Area("Api")]
    [ApiController]
    [Route("api/[controller]")]
    public class HomeController : ControllerBase
    {

        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }
        /// <summary>
        /// 获取张三的个人信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public JsonResult Get()
        {
            return new JsonResult(new
            {
                name = "张三",
                sex = "男",
                age = "20"
            });
        }

        /// <summary>
        /// 计算a加b的和
        /// </summary>
        /// <param name="a">第一个数</param>
        /// <param name="b">第二个数</param>
        /// <returns>a加b的等式和</returns>
        [HttpGet]
        public string GetResult(double a, double b)
        {
            return string.Format($"{a}+{b}={a + b}");
        }
    }


}
